package com.epam.qanda.jstl.tag;

import static com.epam.qanda.i18n.Bundler.getBundler;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

public class LocaleTag extends TagSupport {
	private static final long serialVersionUID = 1L;

	private String mName;

	public void setmName(String mName) {
		this.mName = mName;
	}

	@Override
	public int doStartTag() throws JspException {
		String value;
		try {
			value = new String(getBundler().getString(mName).getBytes("ISO-8859-1"), "UTF-8");
			pageContext.getOut().print(value);
		} catch (IOException e) {
			e.printStackTrace();
		}

		return SKIP_BODY;
	}
}